#include "../bsp/clk/bsp_clk.h"
#include "../bsp/delay/bsp_delay.h"
#include "../bsp/int/bsp_int.h"
#include "../bsp/keyfilter/bsp_keyfilter.h"
#include "../bsp/led/bsp_led.h"
#include "../bsp/mpu6050/bsp_mpu6050.h"
#include "../bsp/rtc/bsp_rtc.h"
#include "../bsp/w25q64/w25q64.h"
#include "../stdio/include/stdio.h"

uint8_t MID;  // 定义用于存放MID号的变量
uint16_t DID; // 定义用于存放DID号的变量

uint8_t ArrayWrite[] = {0x09, 0x02, 0x03, 0x04}; // 定义要写入数据的测试数组
uint8_t ArrayRead[4]; // 定义要读取数据的测试数组

int main(void) {

  int_init();      /* 初始化中断(一定要最先调用！) */
  imx6u_clkinit(); /* 初始化系统时钟 			*/
  clk_enable();    /* 使能所有的时钟 			*/
  led_init();      /* 初始化led 			*/

  W25Q64_Init();

  /*W25Q64功能函数测试*/
  W25Q64_SectorErase(0x000000); // 扇区擦除
  W25Q64_PageProgram(0x000000, ArrayWrite,
                     4); // 将写入数据的测试数组写入到W25Q64中

  W25Q64_ReadData(0x000000, ArrayRead,
                  4); // 读取刚写入的测试数据到读取数据的测试数组中

  int i = 0;
  for (; i < 4; i++) {
    printf("arrayWrite=%d \r\n", ArrayWrite[i]);
    printf("ArrayRead=%d \r\n", ArrayRead[i]);
  }

  while (1) {
  }
  return 0;
}
